package cn.tedu.zblogs.home.controller;


import cn.tedu.base.response.JsonResult;

import cn.tedu.zblogs.home.pojo.VO.AdvertisementVO;
import cn.tedu.zblogs.home.service.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Slf4j
@Api(tags = "广告服务")
@RestController
@RequestMapping("/home")
// 解决跨域问题  使用网关的时候需要注释掉
//@CrossOrigin
public class AdvertisementController {

    @Autowired
    private HomeService homeService;

    @ApiOperation(value = "客服端查询广告")
    @GetMapping("advertisement/lselect")
    public JsonResult AdvertisemenSelect(){
        log.debug("广告查询");
        List<AdvertisementVO> list= homeService.selectAll();
        return JsonResult.ok(list);
    }

}
